import request from '@/utils/request'
import Cookies from 'js-cookie'

// 渲染列表
export function getUserList(params) {
  return request({
    url: '/api/user-service/user/search',
    params
  })
}
// 获取角色列表
export function getUserType() {
  return request({
    url: '/api/user-service/role',
    headers: {
      'Content-Type': 'application/json'
    },
    params: {
      loginName: 'demo',
      account: 'demo',
      password: '888itcast.CN764%...',
      loginType: 0,
      code: Cookies.get('code'),
      clientToken: Cookies.get('clientToken')

    }
  })
}
// 获取区域列表
export function getRegionType() {
  return request({
    url: '/api/vm-service/region/search',
    params: {
      pageIndex: 1,
      pageSize: 100000
    }
  })
}
// 新增人员
export function addUser(data) {
  return request({
    url: '/api/user-service/user',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}
// 修改
export function chooseUser(data) {
  return request({
    url: `/api/user-service/user/${data.id}`,
    method: 'put',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}
// 删除
export function delUser(id) {
  return request({
    url: `/api/user-service/user/${id}`,
    method: 'delete',
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

